-use std::io::{fs, UserRWX, File};
+use std::io::{fs, UserRWX, File, TempDir};
use std::io::fs::PathExtensions;
use std::os;
})
test!(finds_author_user {
- assert_that(cargo_process("new").arg("foo").env("USER", Some("foo")),
+ // Use a temp dir to make sure we don't pick up .cargo/config somewhere in
+ // the hierarchy
+ let td = TempDir::new("cargo").unwrap();
+ assert_that(cargo_process("new").arg("foo").env("USER", Some("foo"))
+ .cwd(td.path().clone()),
execs().with_status(0));
- let toml = paths::root().join("foo/Cargo.toml");
+ let toml = td.path().join("foo/Cargo.toml");
let toml = File::open(&toml).read_to_string().assert();
assert!(toml.as_slice().contains(r#"authors = ["foo"]"#));
})